import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSEditor } from '../ipseditor';
import { IPSDEGridEditItem } from './ipsdegrid-edit-item';
import { IPSDEGridEditItemUpdate } from './ipsdegrid-edit-item-update';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class HiddenPSDEGridEditItemImpl extends PSModelObjectImpl implements IPSDEGridEditItem {
  get caption(): string {
    return this.M.caption;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get createDV(): string {
    return this.M.createDV;
  }

  get createDVT(): 'SESSION' | 'APPLICATION' | 'UNIQUEID' | 'CONTEXT' | 'PARAM' | 'OPERATOR' | 'OPERATORNAME' | 'CURTIME' | 'APPDATA' {
    return this.M.createDVT;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get enableCond(): 0 | 1 | 2 | 3 {
    return this.M.enableCond;
  }

  get ignoreInput(): 0 | 1 | 2 | 3 {
    return this.M.ignoreInput;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get outputCodeListConfigMode(): 0 | 1 | 2 {
    return this.M.outputCodeListConfigMode != null ? this.M.outputCodeListConfigMode : 0;
  }

  protected psappdefield: IPSAppDEField | null = null;

  getPSAppDEField(): IPSAppDEField | null {
    if (this.psappdefield != null) return this.psappdefield;
    const value = this.M.getPSAppDEField;
    if (value == null) {
      return null;
    }
    this.psappdefield = this.getPSModel4('app.dataentity.IPSAppDEField', value, 'getPSAppDEField') as IPSAppDEField;
    return this.psappdefield;
  }

  get psAppDEField(): IPSAppDEField | null {
    return this.getPSAppDEField();
  }

  getPSAppDEFieldMust(): IPSAppDEField {
    const value = this.getPSAppDEField();
    if (value == null) {
      throw new Error('未指定应用实体属性');
    }
    return value;
  }

  protected psdegridedititemupdate: IPSDEGridEditItemUpdate | null = null;

  getPSDEGridEditItemUpdate(): IPSDEGridEditItemUpdate | null {
    if (this.psdegridedititemupdate != null) return this.psdegridedititemupdate;
    const value = this.M.getPSDEGridEditItemUpdate;
    if (value == null) {
      return null;
    }
    this.psdegridedititemupdate = this.getPSModel4('control.grid.IPSDEGridEditItemUpdate', value, 'getPSDEGridEditItemUpdate') as IPSDEGridEditItemUpdate;
    return this.psdegridedititemupdate;
  }

  get psDEGridEditItemUpdate(): IPSDEGridEditItemUpdate | null {
    return this.getPSDEGridEditItemUpdate();
  }

  getPSDEGridEditItemUpdateMust(): IPSDEGridEditItemUpdate {
    const value = this.getPSDEGridEditItemUpdate();
    if (value == null) {
      throw new Error('未指定表格编辑项更新对象');
    }
    return value;
  }

  protected pseditor: IPSEditor | null = null;

  getPSEditor(): IPSEditor | null {
    if (this.pseditor != null) return this.pseditor;
    const value = this.M.getPSEditor;
    if (value == null) {
      return null;
    }
    this.pseditor = this.getPSModel4('control.IPSEditor', value, 'getPSEditor') as IPSEditor;
    return this.pseditor;
  }

  get psEditor(): IPSEditor | null {
    return this.getPSEditor();
  }

  getPSEditorMust(): IPSEditor {
    const value = this.getPSEditor();
    if (value == null) {
      throw new Error('未指定编辑器对象');
    }
    return value;
  }

  get resetItemName(): string {
    return this.M.resetItemName;
  }

  get unitName(): string {
    return this.M.unitName;
  }

  get unitNameWidth(): number {
    return this.M.unitNameWidth != null ? this.M.unitNameWidth : 0;
  }

  get updateDV(): string {
    return this.M.updateDV;
  }

  get updateDVT(): 'SESSION' | 'APPLICATION' | 'UNIQUEID' | 'CONTEXT' | 'PARAM' | 'OPERATOR' | 'OPERATORNAME' | 'CURTIME' | 'APPDATA' {
    return this.M.updateDVT;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get valueItemName(): string {
    return this.M.valueItemName;
  }

  get allowEmpty(): boolean {
    return this.M.allowEmpty;
  }

  get convertToCodeItemText(): boolean {
    return this.M.convertToCodeItemText != null ? this.M.convertToCodeItemText : false;
  }

  get enableUnitName(): boolean {
    return this.M.enableUnitName != null ? this.M.enableUnitName : false;
  }

  get needCodeListConfig(): boolean {
    return this.M.needCodeListConfig != null ? this.M.needCodeListConfig : false;
  }

  get cls(): string {
    return 'HiddenPSDEGridEditItemImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.grid.IPSDEGridEditItem') return true;
    return super.instanceof(cls);
  }
}
